package com.suntront.module_datasynch.adapter;

import android.content.Context;
import android.widget.CheckBox;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.suntront.lib_db.table.MeterT;
import com.suntront.module_datasynch.R;

import java.util.List;

/**
 * @author mtj
 * @Package com.suntront.module_datasynch.adapter
 * @date 2020-05-27 10:16:07
 */

public class TaskUpAdapter extends BaseQuickAdapter<MeterT, BaseViewHolder> {

    private Context context;

    public TaskUpAdapter(Context context, List<MeterT> list) {
        super(R.layout.item_taskup, list);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, MeterT model) {
        int position = holder.getLayoutPosition();
        holder.setText(R.id.meter_name, model.getRosterName() + "(" + model.getRosterCode() + ")");
        holder.setText(R.id.meter_uncopy, model.getUnCopyCount() + "");
        holder.setText(R.id.meter_uncopy_meter, model.getUnUpLoadCount() + "");
        CheckBox checkBox = holder.getView(R.id.meter_choose);
        checkBox.setOnCheckedChangeListener((buttonView, isChecked) ->
                model.setChoose(isChecked)
        );
    }
}